package com.cscw.caishiquan.httpclientDemo;

import java.io.IOException;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;

public class CookieDemo {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws HttpException 
	 */
	public static void main(String[] args) throws HttpException, IOException {
		 HttpClient client = new HttpClient(); 
		 
	     //设置代理服务器地址和端口     
	     //client.getHostConfiguration().setProxy("proxy_host_addr",proxy_port);
		 
	     HttpMethod method = new PostMethod("http://www.google.com"); 
	     
	     
	     
	     client.executeMethod(method);
	        
	     //打印服务器返回的状态
	     System.out.println(method.getStatusLine());
	     
	    //打印返回的信息
	     System.out.println(method.getResponseBodyAsString());
	     
	     //释放连接
	     method.releaseConnection();

	}

}
